//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Diagnostics;
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class MoveRangeUndoUnit: IUndoUnit
    {
        public MoveRangeUndoUnit(Range range, CellAddress originalAddress)
        {
            _worksheet = range.Worksheet;
            _rangeAddress = range.Address;
            this._originalAddress = originalAddress; 
        }

        readonly Worksheet _worksheet;
        RangeAddress _rangeAddress;
        readonly CellAddress _originalAddress;
        #region IUndoUnit Members

        public void Do()
        {
            Debug.WriteLine("Do moveRangeUndoUnit");

            _worksheet.MoveRange(_worksheet.GetRange(_rangeAddress), _originalAddress);
          //\\  _worksheet.Selection = _worksheet.GetRange(_rangeAddress).Offseted(_originalAddress - _rangeAddress.TopLeft);
        }

        public bool Merge(IUndoUnit unit)
        {
            return false;
        }

        #endregion
    }
}
